package com.fub.util.database.databaseHelper;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class RelationDatabaseManager extends SQLiteOpenHelper {

	public static final String TABLE_NAME_RELATIONS = "relations";
	public static final String COL_BUILDING_ID = "building_id";
	public static final String COL_RELATION_ID = "relation_id";
	public static final String COL_TYPE = "type";
	public static final String COL_NODE_ID = "node_id";
	private static final String DATABASE_NAME = "relations.db";
	private static final int Version = 1;
	private static final String CREATE_TABLE_WALLS = String
			.format("create table %s (%s text not null, %s text not null, %s text not null ,%s text not null);",
					TABLE_NAME_RELATIONS, COL_BUILDING_ID, COL_RELATION_ID,
					COL_TYPE, COL_NODE_ID);

	public RelationDatabaseManager(Context context) {
		super(context, DATABASE_NAME, null, Version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_TABLE_WALLS);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME_RELATIONS);
		onCreate(db);
	}
}
